#version 400

//Defining how many vertices this patch will output:
layout(vertices = 4) out;
//Tessellator consumes all vertices from the TCS and emits tessellated triangles, quads, or lines

in vec3 vNormal[];
in vec3 vPosition[];
in vec3 vLightDir[];

out vec3 tcNormal[];
out vec3 tcPosition[];
out vec3 tcLightDir[];

float tessLevelInner = 2.0; 
float tessLevelOuter = 2.0; 


void main()
{
	//if(gl_InvocationID-3 < 0)
		tcLightDir[gl_InvocationID] = vLightDir[gl_InvocationID];
		tcPosition[gl_InvocationID] = vPosition[gl_InvocationID];
		tcNormal[gl_InvocationID] = vNormal[gl_InvocationID];
	//else
		//tcPosition[gl_InvocationID] = vPosition[gl_InvocationID-3];

	if(gl_InvocationID == 0)
	{
		gl_TessLevelInner[0] = tessLevelInner; // number of nested primitives to generate
		gl_TessLevelOuter[0] = tessLevelOuter; // times to subdivide first side
		gl_TessLevelOuter[1] = tessLevelOuter; // times to subdivide second side
		gl_TessLevelOuter[2] = tessLevelOuter; // times to subdivide third side
	}
	//gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
}